package com.dragonfly.shutter.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.dragonfly.shutter.DAOs.PictureDAO;
import com.dragonfly.shutter.beans.PictureBrief;

/**
 * 主页控制器
 * @author 黄挺
 *
 */
@Controller
@RequestMapping("/index.html")
public class IndexController {
	@Autowired
	private PictureDAO pictureDAO;
	
	@RequestMapping(method = RequestMethod.GET)
	public ModelAndView onLoad(){
		List<PictureBrief> pictures = pictureDAO.selectRecentUploadPublicPic(4);
		return new ModelAndView("index", "pictures", pictures);
	}
}
